var input1 = $(".imgup1");
var input2 = $(".imgup2");
var img = $(".imgupl");

function aaa(b, a) {
    var files = b.files;
    $.each(files, function(key, value) {
        var fileReader = new FileReader();
        fileReader.readAsDataURL(value);
        var img = document.createElement("img");
        fileReader.onload = function(e) {
            img.src = e.target.result;
        }
        a.parent().append(img)
    })


}
function cleartext(b){
    b.parent().css({
        "margin-top": "0",
    })
    b.parent().find("img").css({
    })
    b.parent().find("p").remove();
}
input1.change(function() {
    var $this = $(this)
    var a = input1;
    aaa(this, a);
    $(".close1").remove()
    cleartext($this)
})
input2.change(function() {
    var $this = $(this)
    var a = input2;
    aaa(this, a);
    cleartext($this)

    $(".close2").remove()
})
$(".payway").click(function() {
    for (var i = 0; i < $(".payway").length; i++) {
        $(".payway").attr("src", "../../img/icon/radio-default.png")
    }
    $(this).attr("src", "../../img/icon/radio-select.png")
})
$(".zuway").click(function() {
    for (var i = 0; i < $(".zuway").length; i++) {
        $(".zuway").attr("src", "../../img/icon/radio-default.png")
    }
    $(this).attr("src", "../../img/icon/radio-select.png")
})
